package com.itheima.homework;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

public class Work1 {
    public static void main(String[] args) {
        HashMap<String , ArrayList<String>> hm = new HashMap<>();
        ArrayList<String> xyj = new ArrayList<>();
        Collections.addAll(xyj,"唐僧","孙悟空","猪八戒","沙和尚");
        hm.put("西游记",xyj);

        ArrayList<String> shz = new ArrayList<>();
        Collections.addAll(shz,"宋江","卢俊义","林冲","武松");
        hm.put("水浒传",shz);

        ArrayList<String> sgyy = new ArrayList<>();
        Collections.addAll(sgyy,"诸葛亮","司马懿","周公瑾","郭嘉");
        hm.put("三国演义",sgyy);

        ArrayList<String> hlm = new ArrayList<>();
        Collections.addAll(hlm,"贾宝玉","林黛玉","薛宝钗","刘姥姥");
        hm.put("红楼梦",hlm);

        hm.forEach((key , value) -> {
            System.out.println(key + ":");
            for (int i = 0; i < value.size(); i++) {
                System.out.print("\t"+ value.get(i));
                if ((i+1)%2==0)
                    System.out.print("\n");
            }
        });

    }
}
